package main

import "fmt"

// Author : CSR丶WARRIOR
// Time ： 2020/10/13  20:20
// TOOLS : GoLand
// FILENAME : initSlice.go
// STATEMENT: 初始化切片的值

func main() {
	/*var s1 []int
	s1 = append(s1, 5, 6, 7, 8)
	fmt.Println(s1) //[5 6 7 8]*/

	/*	s1 := []int{6, 7, 8, 9}
		s1 = append(s1, 11, 23)
		s1[0] = 17      //修改切片第一个元素
		fmt.Println(s1) //[17 7 8 9 11 23]*/

	//make函数初始化
	var s1 = make([]int, 3, 7)
	s1 = append(s1, 2, 3, 4)
	for i := 0; i < len(s1); i++ {
		s1[i] = i * 2
	}
	fmt.Println(s1) //[0 2 4 6 8 10]
}
